import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ParkProductCouponVO, ParkProductCouponForm, ParkProductCouponQuery } from '@/api/park/parkProductCoupon/types';

/**
 * 查询产品劵列表
 * @param query
 * @returns {*}
 */

export const listParkProductCoupon = (query?: ParkProductCouponQuery): AxiosPromise<ParkProductCouponVO[]> => {
  return request({
    url: '/park/parkProductCoupon/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询产品劵详细
 * @param couponId
 */
export const getParkProductCoupon = (couponId: string | number): AxiosPromise<ParkProductCouponVO> => {
  return request({
    url: '/park/parkProductCoupon/' + couponId,
    method: 'get'
  });
};

/**
 * 新增产品劵
 * @param data
 */
export const addParkProductCoupon = (data: ParkProductCouponForm) => {
  return request({
    url: '/park/parkProductCoupon',
    method: 'post',
    data: data
  });
};

/**
 * 修改产品劵
 * @param data
 */
export const updateParkProductCoupon = (data: ParkProductCouponForm) => {
  return request({
    url: '/park/parkProductCoupon',
    method: 'put',
    data: data
  });
};

/**
 * 删除产品劵
 * @param couponId
 */
export const delParkProductCoupon = (couponId: string | number | Array<string | number>) => {
  return request({
    url: '/park/parkProductCoupon/' + couponId,
    method: 'delete'
  });
};
